package com.wly.datapool.soldierpool;

import java.util.ArrayList;

import com.wly.datapool.skillpool.SkillPool;
import com.wly.datapool.skillpool.skill.SkillStatic;
import com.wly.define.IDZoneDefine;

public class SoldierPool
{
	private ArrayList<SoldierStatic> _soldierArr;
	private static SoldierPool       _instance;
	
	private SoldierPool()
	{
		initSoldierPool();
	}
	
	static public SoldierPool getInstance()
	{
		if(_instance == null)
		{
			_instance = new SoldierPool();
		}
		return _instance;
	}

	private void initSoldierPool()
	{
		_soldierArr = new ArrayList<SoldierStatic>();
	}
	
	public SoldierStatic getSoldierByTemplateId(int templateId)
	{
		return _soldierArr.get(templateId-IDZoneDefine.SOLDIER_START_ID);
	}
	
	public SoldierStatic getSoldierBySoldierId(int soldierId)
	{
		return _soldierArr.get(soldierId);
	}
	
	public void addSoldier(SoldierStatic soldier)
	{
		_soldierArr.add(soldier.id-IDZoneDefine.SOLDIER_START_ID, soldier);
	}
}
